package com.zhangwei.xmppdemo;

import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.Button;
import android.widget.ImageView;

import com.zhangwei.xmppdemo.xmpp.XmppHelper;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;

/**
 * TextInputLayout 四个常用方法
 * 1> setHint()：设置提示语。
 * 2> getEditText()：得到TextInputLayout中的EditView控件。
 * 3> setErrorEnabled():设置是否可以显示错误信息。
 * 4> setError()：设置当用户输入错误时弹出的错误信息。
 */
@EActivity(R.layout.activity_register)
public class RegisterActivity extends AppCompatActivity {

    @ViewById
    Toolbar toolbar;
    @ViewById
    ImageView registerHeadImg;
    @ViewById
    TextInputLayout registerNameTextinput;
    @ViewById
    TextInputLayout registerPwdTextinput;
    @ViewById
    TextInputLayout registerPwdConfirmTextinput;
    @ViewById
    Button registerBtn;
    @ViewById
    FloatingActionButton fab;

    @AfterViews
    public void init() {

    }

    @Click(R.id.register_btn)
    public void onClick() {
        String userName = registerNameTextinput.getEditText().getText().toString().trim();
        String pwd = registerPwdTextinput.getEditText().getText().toString().trim();
        XmppHelper.getInstance().resiter(userName, pwd);
    }


}
